<!--
 * @Descripttion: 
 * @version: 
 * @Author: 淏
 * @Date: 2023-11-25 17:19:32
 * @LastEditors: 淏
 * @LastEditTime: 2024-03-12 13:11:27
-->
<template>
  <div class="cardDiv">
    <el-card :style="color" shadow="hover" :class="cardHight" v-waves>
      <!--       <div slot="header" class="clearfix">
        <span>
          <el-tag
            size="medium"
            class="button"
            style="border-radius: 5px"
            @click="getImportData(1, cardData)"
            :type="cardData.haveData === true ? 'success' : 'primary'"
          >
            <span class="text" style="color: #ffffff">
              {{ cardData.haveData | haveData }}
            </span>
          </el-tag>
        </span>
        <el-popconfirm
          title="确定删除该数据吗？"
          @confirm="getImportData(4, cardData)"
        >
          <el-button
            slot="reference"
            style="float: right; border-radius: 20px"
            size="small"
            icon="el-icon-delete"
            class="button"
            type="danger"
            circle
            plain
          ></el-button>
        </el-popconfirm>
      </div> -->
      <div @dblclick="handleDoubleClick(1, cardData)">
        <span class="text">
          {{ cardData.importData.name }}
        </span>
        <div class="bottom clearfix">
          <time class="time text">
            {{ cardData.importData.importDate }}
          </time>
        </div>
        <div style="margin-top: 10px">
          <span>
            <el-tag
              class="button"
              style="border-radius: 5px"
              @click="getImportData(1, cardData)"
              :type="cardData.haveData === true ? 'success' : 'primary'"
            >
              <span class="text" style="color: #ffffff">
                {{ cardData.haveData | haveData }}
              </span>
            </el-tag>
          </span>
          <el-popconfirm
            title="确定删除该数据吗？"
            @confirm="getImportData(4, cardData)"
          >
            <el-button
              slot="reference"
              style="float: right; border-radius: 20px"
              size="small"
              icon="el-icon-delete"
              class="button"
              type="danger"
              circle
              plain
            ></el-button>
          </el-popconfirm>
        </div>
        <div style="margin-top: 10px">
          <el-row :gutter="24">
            <el-col :span="12">
              <el-button
                size="small"
                type="primary"
                class="button"
                style="padding: 3px 15px"
                plain
                round
                icon="el-icon-zoom-in"
                @click="getImportData(1, cardData)"
              >
                查看
              </el-button>
            </el-col>
            <el-col :span="12">
              <el-button
                size="small"
                type="warning"
                class="button"
                style="padding: 3px 15px"
                plain
                round
                icon="el-icon-edit"
                @click="getImportData(2, cardData)"
              >
                编辑名称
              </el-button>
            </el-col>
          </el-row>
        </div>
        <div
          style="margin-top: 10px"
          v-if="cardData.importData.type == 'import'"
        >
          <el-row :gutter="24">
            <el-col :span="12">
              <el-button
                size="small"
                type="success"
                class="button"
                style="padding: 3px 15px"
                plain
                round
                icon="el-icon-upload2"
                @click="getImportData(0, cardData)"
              >
                录入
              </el-button>
            </el-col>
            <el-col :span="12">
              <el-button
                size="small"
                type="warning"
                class="button"
                style="padding: 3px 15px"
                plain
                round
                icon="el-icon-edit"
                @click="getImportData(3, cardData)"
              >
                数据字段
              </el-button>
            </el-col>
          </el-row>
        </div>
      </div>
    </el-card>
  </div>
</template>

<script>
  export default {
    // 组件名称
    name: 'importCard',
    // 组件参数 接收来自父组件的数据
    props: {
      cardData: {
        type: Object,
        required: true,
      },
      color: {
        type: Object,
        required: true,
      },
    },
    filters: {
      haveData(src) {
        if (src == true) {
          return '数据已录入'
        } else {
          return '数据未录入'
        }
      },
    },
    // 局部注册的组件
    components: {},
    // 组件状态值
    data() {
      return {}
    },
    // 计算属性
    computed: {
      cardHight: function () {
        if (this.cardData.importData.type == 'import') {
          return 'cardHight02'
        } else {
          return 'cardHight01'
        }
      },
    },
    // 侦听器
    watch: {},
    // 组件方法
    methods: {
      //card的颜色
      getImportData(type, row) {
        this.$emit('getImportDataS', type, row)
      },
      handleDoubleClick(type, row) {
        this.$emit('getImportDataS', type, row)
      },
    },
    created() {},
    mounted() {},
  }
</script>

<style scoped>
  .waves-effect {
    display: block;
  }
  .cardDiv {
    margin-top: 15px;
    transition: all 0.5s;
  }
  .cardDiv:hover {
    background: linear-gradient(#3fc6e8, #109efd) !important;
    color: #00fbfe;
    text-shadow: 0 0 25px #00fbfe;
    transform: scale(1.1);
    font-weight: 700;
  }
  .text {
    color: #ffffff;
    text-shadow: 0 0 25px #ffffff;
    font-weight: 700;
  }
  .cardInfo {
    height: 238px;
  }
  .bottom {
    margin-top: 13px;
    line-height: 12px;
  }
  .button {
    margin-top: 13px;
    background: rgba(0, 0, 255, 0.2);
    border-radius: 10px;
    border: 1px solid #295a85;
    color: #00ffff;
    text-shadow: 0 0 25px #00ffff;
    font-weight: 700;
  }
  .clearfix:before,
  .clearfix:after {
    display: table;
    content: '';
  }

  .clearfix:after {
    clear: both;
  }
</style>
<style lang="less" scoped>
  /deep/ .el-card {
    border: 1px solid #00ffff80;
  }
  /deep/ .el-card__header {
    border-bottom: 1px solid #00ffff80;
  }
  .cardHight01 {
    height: 200px;
  }
  .cardHight02 {
    height: 220px;
  }
</style>
